#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<assert.h>
//char* my_strncpy(char* strDest, const char* strSource, size_t count)
//{
//	assert(strDest && strSource);
//	char* ret = strDest;
//	
//	for (int i = 0;i < count;i++)
//	{
//		*(strDest + i) = *(strSource+i);
//	}
//	return ret;
//}
char* my_strncat(char* strDest, const char* strSource, size_t count)
{
	char* ret = strDest;
	while (*strDest)
	{
		strDest++;
	}
	int i = 0;
	for (i = 0;i < count;i++)
	{
		*(strDest+i) = *(strSource+i);
	}
	*(strDest + i) = '\0';
	return ret;
}
int main()
{
	/*char string[100] = "Cats are nice usually";
	printf("Before: %s\n", string);
	my_strncpy(string, "Dogs", 4);
	my_strncpy(string + 9, "mean", 4);
	printf("After:  %s\n", string);*/
	char string[80] = "This is the initial string!";
	char suffix[] = " extra text to add to the string...";
	/* Combine strings with no more than 19 characters of suffix: */
	printf("Before: %s\n", string);
	my_strncat(string, suffix, 19);
	printf("After:  %s\n", string);

	return 0;
}